FROM  golang:1.18 as build
ENV GO111MODULE=on
ENV CGO_ENABLED=0
WORKDIR /app

COPY util util
COPY go.mod go.mod
COPY main.go main.go
COPY server.go server.go

RUN go build -o spark-port-proxy

FROM alpine:3.17 as ship
WORKDIR /home/app
COPY --from=build /app/spark-port-proxy .

EXPOSE 8080

CMD ["./spark-port-proxy"]